﻿/**
 * PPMS微积分洗hP
 * From:芬芬时尚潮流
 */
var 音符 = "#fEffect/CharacterEff/1032063/0/0#";
var UI0 = "#fEffect/CharacterEff/1051296/1/0#";
var UI1 = "#fEffect/CharacterEff/1051296/1/1#";
var UI2 = "#fEffect/CharacterEff/1051296/1/2#";
var UI3 = "#fEffect/CharacterEff/1051296/1/3#";
var UI4 = "#fEffect/CharacterEff/1051296/1/4#";
var UI5 = "#fEffect/CharacterEff/1051296/1/5#";
var 音符横条 = 音符 + 音符 + 音符 + 音符 + 音符 + 音符 + 音符;
var 蓝星横条 = UI0 + UI1 + UI2 + UI3 + UI4 + UI5 + UI0 + UI1 + UI2 + UI3 + UI4 + UI5 + UI0 + UI1 + UI2 + UI3 + UI4;

//每点需要的PPMS微积分
var energy = 30;

var status = 0;


function start() {
    status = -1;
    action(1, 0, 0);
}

function action(mode, type, selection) {
    if (mode == -1 || mode == 5) {
        cm.dispose();
    } else if (mode == 0) {
        cm.dispose();
    } else {
        if (mode == 1)
            status++;
        else
            status--;
        if (status == 0) {
          //  abb = 1;
			cm.sendGetText("" + 音符横条 + "\r\n                #r#e " + cm.getServerName() + "PPMS微积分洗血 #d#n#k\r\n\r\n" + 蓝星横条 + "\r\n\r\n\r\n请输入你想洗的数量.1血="+energy+"PPMS微积分.系统会为您自动计算费用.\r\n您目前的总HP为：#b" + cm.getPlayerStat("MAXHP"));
        } else if (status == 1) {
			
            var xl = cm.getPlayerStat("MAXHP");
            if (xl == 500000) {
                cm.playerMessage(1, "亲爱的" + cm.getChar().getName()+"\r\n\r\n抱歉！您血量已到最大值\r\n\r\n不能继续增加血量了\r\n\r\n血量：" + xl);
                cm.dispose();
            } else {
                if (/^[a-zA-Z]*$/.test(cm.getText())) {
                    cm.playerMessage(1, "请输入整数数值\r\n\r\n不可包含字母");
                    cm.dispose();
                } else if (/^[\u4e00-\u9fa5]*$/.test(cm.getText())) {
                    cm.playerMessage(1, "请输入整数数值\r\n\r\n不可包含汉字");
                    cm.dispose();
                } else if (cm.getText() < 1) {
                    cm.playerMessage(1, "数值不能小于 [1] \r\n\r\n 数值不能大于 [10000] \r\n\r\n请玩家重新调整数值");
                    cm.dispose();
                } else if (cm.getText() > 10000) {
                    cm.playerMessage(1, "数值不能小于 [1] \r\n\r\n 数值不能大于 [10000] \r\n\r\n请玩家重新调整数值");
                    cm.dispose();
                } else {
                        cm.sendYesNo("" + 音符横条 + "\r\n                #r#e " + cm.getServerName() + "PPMS微积分洗血 #d#n#k\r\n\r\n" + 蓝星横条 + "\r\n\r\n\r\n#r[ #h # ]尊敬的玩家 以下是系统为您计算的费用\r\n\r\n血量增#d：" + cm.getText() + "#r\r\n用PPMS微积分：#d" + cm.getText() * energy + "\r\n\r\n#r　　　　请仔细阅读 无误请单击确认！！");
                }
            }
        } else if (status == 2) {
                var getmaxhp = cm.getChar().getStat().getMaxHp();
                if (cm.getPlayerEnergy() >= cm.getText() * energy) {
                    cm.gainPlayerEnergy(-cm.getText() * energy);
					cm.getChar().getStat().gainMaxHp(cm.getText() * 1, cm.getChar());
                    cm.worldSpouseMessage(0x15, "[ PPMS微积分洗血 ] ：尊敬的玩家" + cm.getChar().getName() + "花费了 " + cm.getText() * energy + " PPMS微积分增值了 " + cm.getText() + " 血量上限！");
                    cm.sendOk("#d#e恭喜您 [ #h # ] 增值了" + cm.getText() + "血量！");
                    cm.dispose();
                } else {
                    cm.sendOk("#d#e抱歉玩家\r\n\r\n您好像没有那么多PPMS微积分哦！");
                    cm.dispose();
                }
        }
    }
}